<?php slot('sub', $sub); ?>

<script>
    var hotelsPrice = [];
    var roomsPrice = [];
<?php foreach ($hotels as $h) { ?>
        var temp = {
            id: '<?php echo $h->getId() ?>',
            name: '<?php echo $h->getNameEn() ?>',
            city_id: '<?php echo $h->getCityId() ?>'
        };
        hotelsPrice.push(temp);
<?php } ?>
<?php foreach ($rooms as $r) { ?>
        var temp = {
            id: '<?php echo $r->getId() ?>',
            name: '<?php echo $r->getName() ?>',
            hotel_id: '<?php echo $r->getHotelId() ?>'
        };
        roomsPrice.push(temp);
<?php } ?>
    var searchParamPrice = {
        city: '<?php echo $arrSearch['city'] ?>',
        hotel: '<?php echo $arrSearch['hotel'] ?>',
        room: '<?php echo $arrSearch['room'] ?>',
        from: '<?php echo $arrSearch['from'] ?>',
        to: '<?php echo $arrSearch['to'] ?>',
        string: '<?php echo $arrSearch['string'] ?>'
    };
</script>

<div class="center">
    <div class="center_sub_conteiner">

        <div class="center_block">
            <div class="header_center_block"><span>Search</span></div>
            <div class="ui_one_line">
                <div class="ui_block_in_line">
                    <label for="price_select_city">City</label>
                    <select id="price_select_city">
                        <option value="0">Please select a city</option>
                        <?php
                        foreach ($city as $c) {
                            if ($c->getId() == $arrSearch['city']) {
                                echo '<option value="' . $c->getId() . '" selected="selected">' . $c->getNameEn() . '</option>';
                            } else {
                                echo '<option value="' . $c->getId() . '">' . $c->getNameEn() . '</option>';
                            }
                        }
                        ?>
                    </select>
                </div>
                <div class="ui_block_in_line">
                    <label for="price_select_city">Hotel</label>
                    <select id="price_select_hotel">
                        <option value="0" selected="selected">Please select a hotel</option>
                    </select>
                </div>
                <div class="ui_block_in_line">
                    <label for="price_select_room">Room</label>
                    <select id="price_select_room">
                        <option value="0" selected="selected">Please select a room</option>
                    </select>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_datapicer_block">
                        <label for="price_select_from_date">From date</label>
                        <input type="text" id="price_select_from_date" class="ui_datapicer_input_from" value="<?php echo $arrSearch['from'] ?>">
                        <img src="/web/images/icoCalendar.png" class="ui_datapicer_img_from"/>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_datapicer_block">
                        <label for="price_select_to_date">To date</label>
                        <input type="text" id="price_select_to_date" class="ui_datapicer_input_to" value="<?php echo $arrSearch['to'] ?>">
                        <img src="/web/images/icoCalendar.png"  class="ui_datapicer_img_to"/>
                    </div>
                </div>
                <div class="ui_block_right_line">
                    <input type="button" id="price_button_search" class="ui_orange_short_button" value="Search">
                </div>
            </div>
            <div class="ui_one_line">
                <div class="ui_line_error"></div>
            </div>
        </div>

        <div class="center_block">
            <div class="header_center_block"><span>Update prices</span></div>
            <div class="ui_one_line">
                <div class="ui_block_in_line">
                    <label for="price_select_period">Period</label>
                    <select id="price_select_period">
                        <option value="1" selected="selected">1</option>
                        <?php
                        for ($i = 2; $i <= 10; $i++) {
                            echo '<option value="' . $i . '">' . $i . '</option>';
                        }
                        ?>
                    </select>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_radio_text_right">
                        <input type="radio" name="price_radio_days" value="all_days" checked>
                        <label>All days</label>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_radio_text_right">
                        <input type="radio" name="price_radio_days" value="working_days">
                        <label>Working days</label>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_radio_text_right">
                        <input type="radio" name="price_radio_days" value="weekend">
                        <label>Weekend</label>
                    </div>
                </div>
            </div>
            <div class="ui_one_line">
                <div class="ui_block_in_line">
                    <div class="ui_block_with_title">
                        <div class="ui_block_title">Fit</div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">USD</div>
                                <input type="text" class="ui_input_text_small" id="price_fit_usd">
                            </div>
                        </div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">NIS</div>
                                <input type="text" class="ui_input_text_small" id="price_fit_nis">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_block_with_title">
                        <div class="ui_block_title">Fit special</div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">USD</div>
                                <input type="text" class="ui_input_text_small" id="price_fit_special_usd">
                            </div>
                        </div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">NIS</div>
                                <input type="text" class="ui_input_text_small" id="price_fit_special_nis">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_block_with_title">
                        <div class="ui_block_title">Cascade</div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">USD</div>
                                <input type="text" class="ui_input_text_small" id="price_cascade_usd">
                            </div>
                        </div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">NIS</div>
                                <input type="text" class="ui_input_text_small" id="price_cascade_nis">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_block_with_title">
                        <div class="ui_block_title">Russian market</div>
                        <div class="ui_block_in_line">
                            <div class="ui_block_with_title">
                                <div class="ui_block_title">USD</div>
                                <input type="text" class="ui_input_text_small" id="price_russian_market_usd">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui_block_right_line">
                    <input type="button" id="price_button_update" class="ui_orange_short_button" value="Update">
                    <div class="ui_short_button_loader" id="price_button_update_loader">Wait<img src="/web/images/302.gif"></div>
                </div>
            </div>
        </div>

        <div class="center_block">
            <div class="header_center_block"><span>Results</span><div class="ui_title_string_block"></div></div>

            <div class="ui_one_line">
                <div class="ui_block_in_line">
                    <div class="ui_normal_title">Date</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">Period</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_double_small_title">Fit</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_double_small_title">Fit special</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_double_small_title">Cascade</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">Russian market</div>
                </div>
            </div>
            <div class="ui_one_line">
                <div class="ui_block_in_line">
                    <div class="ui_normal_title">_</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">_</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">USD</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">NIS</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">USD</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">NIS</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">USD</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">NIS</div>
                </div>
                <div class="ui_block_in_line">
                    <div class="ui_small_title">USD</div>
                </div>
            </div>

            <?php
            foreach ($prices as $p) {
                echo '<div class="ui_one_line has_fill" price_id="' . $p->getId() . '">'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_normal" value="' . $p->getDate() . '" readonly></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small" value="' . $p->getPeriod() . '" readonly></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small fit_usd" value="' . $p->getFitPriceUsd() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small fit_nis" value="' . $p->getFitPriceNis() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small special_usd" value="' . $p->getSpecialPriceUsd() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small special_nis" value="' . $p->getSpecialPriceNis() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small cascade_usd" value="' . $p->getCascadePriceUsd() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small cascade_nis" value="' . $p->getCascadePriceNis() . '"></div>'
                . '<div class="ui_block_in_line"><input type="text" class="ui_input_text_small market_usd" value="' . $p->getRussianMarketUsd() . '"></div>'
                . '<div class="ui_block_right_line"><input type="button" class="ui_gray_short_button" value="Clear">'
                . '<div class="ui_short_button_loader">Wait<img src="/web/images/302.gif"></div></div>'
                . '<div class="ui_block_right_line"><input type="button" class="ui_orange_short_button" value="Update">'
                . '<div class="ui_short_button_loader">Wait<img src="/web/images/302.gif"></div></div>'
                . '</div>';
            }
            ?>
        </div>

    </div>
</div>